<!DOCTYPE html>
<html lang="zh">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>
    
    Java - DSRBLOG
    
  </title>
  

  
  
  <link href="atom.xml" rel="alternate" title="DSRBLOG" type="application/atom+xml">
  <link rel="stylesheet" href="asset/css/style.min.css">
  <link rel="stylesheet" href="asset/css/doc.css">
  <script src="asset/app.js"></script>


</head>

<body> <section class="ct-body">
	<div class="container">
		<div class="columns is-variable bd-klmn-columns is-4 is-centered">
			<div class="column is-four-fifths">
				<div class="post-body single-content">
					
					<h1 class="title">
						Java
					</h1>


					<div class="media">
						
						
						<div class="media-content">
							<div class="content">
								<p>
									<span class="date">2022/09/22 17:15 下午</span>
									

									

									<br />
									<span class="tran-tags">Tags:</span>&nbsp;
									
									<a class="tag is-link is-light">#Java</a>
									

								</p>
							</div>
						</div>

					</div>
				</div>
				<article class="markdown-body single-content">
					<h2><a id="%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>基本语法</h2>
<h3><a id="%E6%A0%87%E8%AF%86%E7%AC%A6" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>标识符</h3>
<ul>
<li>
<p>Java的标识符时用来为<strong>变量、常量、数组、方法、类、对象、接口、包</strong>等命名</p>
</li>
<li>
<p>它们是由<strong>大小写英文字母(A-Z和a-z)</strong>、<strong>数组(0-9)</strong>、<strong>下划线(_)</strong>、<strong>美元符号($)</strong>、<strong>汉字符号</strong>组成</p>
</li>
<li>
<p>标识符必须是<strong>英文字母、下划线、美元或汉字符号</strong>开头</p>
</li>
</ul>
<h3><a id="%E9%80%9A%E7%94%A8%E8%A7%84%E8%8C%83" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>通用规范</h3>
<h4><a id="%E5%8C%85%E5%90%8D" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>包名</h4>
<ul>
<li>所有字母一律小写</li>
<li>一般是所属公司域名的倒序（如：广科域名为<code>gdust.edu.cn</code>，包名则为<code>cn.edu.gdust.项目名称.模块名称</code>）</li>
</ul>
<h4><a id="%E7%B1%BB%E5%90%8D%E3%80%81%E6%8E%A5%E5%8F%A3%E5%90%8D" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>类名、接口名</h4>
<ul>
<li>类名和接口名每个单词的首字母都要大写（如：<code>ArrayList</code>、<code>Iterator</code>）</li>
</ul>
<h4><a id="%E5%B8%B8%E9%87%8F%E5%90%8D%E5%91%BD%E5%90%8D%E8%A7%84%E8%8C%83" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>常量名命名规范</h4>
<ul>
<li>所有字母都要大写，如果有多个单词，单词之间用下划线连接（如：<code>DAY_OF_MONTH</code>）</li>
</ul>
<h2><a id="%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>数据类型</h2>
<h3><a id="%E5%9F%BA%E6%9C%AC%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>基本数据类型</h3>
<ul>
<li>
<p>数值型</p>
<ul>
<li>整数类型(byte,short,int,long)</li>
<li>浮点类型(float,double)</li>
</ul>
</li>
<li>
<p>字符型(char)</p>
</li>
<li>
<p>布尔型(boolean)</p>
</li>
</ul>
<h3><a id="%E5%BC%95%E7%94%A8%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>引用数据类型</h3>
<ul>
<li>类(class)</li>
<li>接口()</li>
</ul>
<h2><a id="%E8%BF%90%E7%AE%97%E7%AC%A6" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>运算符</h2>
<p>基本与C一致</p>
<h3><a id="%E6%B3%A8%E6%84%8F" class="anchor" aria-hidden="true"><span class="octicon octicon-link"></span></a>注意</h3>
<table>
<thead>
<tr>
<th style="text-align: center">运算符</th>
<th style="text-align: center">运算</th>
<th style="text-align: center">范例</th>
<th style="text-align: center">结果</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center"><code>&amp;</code></td>
<td style="text-align: center">与</td>
<td style="text-align: center"><code>a&amp;b</code></td>
<td style="text-align: center">若<code>a</code>为<code>true</code>，<code>b</code>为<code>true</code></br>结果为<code>true</code>，否则为<code>false</code></br>若<code>a</code>为<code>false</code>，继续运算<code>b</code>的结果</td>
</tr>
<tr>
<td style="text-align: center"><code>&amp;&amp;</code></td>
<td style="text-align: center">短路与</td>
<td style="text-align: center"><code>a&amp;b</code></td>
<td style="text-align: center">若<code>a</code>为<code>true</code>，<code>b</code>为<code>true</code></br>结果为<code>true</code>，否则为<code>false</code></br>若<code>a</code>为<code>false</code>，则不运算<code>b</code>的结果</td>
</tr>
<tr>
<td style="text-align: center"><code>|</code></td>
<td style="text-align: center">或</td>
<td style="text-align: center"><code>a|b</code></td>
<td style="text-align: center">若<code>a</code>或<code>b</code>为<code>true</code></br>结果为<code>true</code>，否则为<code>false</code></br>若<code>a</code>为<code>true</code>，继续运算<code>b</code>的结果</td>
</tr>
<tr>
<td style="text-align: center"><code>||</code></td>
<td style="text-align: center">短路</td>
<td style="text-align: center"><code>a||b</code></td>
<td style="text-align: center">若<code>a</code>或<code>b</code>为<code>true</code></br>结果为<code>true</code>，否则为<code>false</code></br>若<code>a</code>为<code>true</code>，则不运算<code>b</code>的结果</td>
</tr>
</tbody>
</table>

				</article>
				<div class="comments-wrap">
					<div class="share-comments">
						

						

						
					</div>
				</div><!-- end comments wrap -->
			</div>
		</div><!-- end columns -->
	</div><!-- end container -->
</section>  






















</body>

</html>